package tg1;

import java.util.Properties;
import java.io.IOException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class TrackerProperties{

	private static Properties props;
	private static TrackerProperties trackerProperties=null;
	
	private TrackerProperties() {
		File file = new File("tg1/tracker.conf");    
		props = new Properties();
		FileInputStream fis = null;
		try {
		     fis = new FileInputStream(file);
			 //System.out.println("arquivo de confAberto com sucesso ");
			 //le os dados que estao no arquivo
			props.load(fis);  
			fis.close();
			props.list(System.out);

			}catch (Exception ex) {
			     //System.out.println(ex.getMessage());
			     ex.printStackTrace();
			}
	}
	
	public synchronized static TrackerProperties getTrackerProperties() {
		if( trackerProperties == null ) {
			trackerProperties = new TrackerProperties();
		}
		return trackerProperties;
	}
	
	public static String getProperty(String prop){
		
		if (trackerProperties == null){
			trackerProperties = getTrackerProperties();
		}
		return props.getProperty(prop);
	}
}	
		